import request from '@/utils/request'

// 列表
export const orderPageList = (data) => {
  return request({
    url: '/sm-sell-order/page-list',
    method: 'post',
    data
  })
}

// 生成出库单
export const orderOutStoreApply = (id, num,addressId,outStoreNo) => {
  return request({
    url: `/sm-sell-order/outStoreApply/${id}?outStoreNum=${num}&addressId=${addressId}&outStoreNo=${outStoreNo}`,
    method: 'post'
  })
}

// 预收提交
export const orderAdvanceCollectSubmit = (id, amount, num) => {
  return request({
    url: `/sm-sell-order/advanceCollectSubmit/${id}?advanceCollectAmount=${amount}&advanceCollectNum=${num}`,
    method: 'post'
  })
}

// 新增
export const orderAdd = (data) => {
  return request({
    url: '/sm-sell-order/add',
    method: 'post',
    data
  })
}

// 转需求
export const orderChangeToDemand = (ids) => {
  return request({
    url: `/sm-sell-order/changeToDemand?idList=${ids}`,
    method: 'post'
  })
}

// 删除
export const orderDel = (id) => {
  return request({
    url: `/sm-sell-order/delete/${id}`,
    method: 'post'
  })
}

// 修改
export const orderModify = (data) => {
  return request({
    url: '/sm-sell-order/modify',
    method: 'post',
    data
  })
}

// 订单导入
export const importOrder = (data) => {
  return request({
    url: '/sm-sell-order/importOrder',
    method: 'post',
    data
  })
}

// 生成合同
export const orderGeneralBargain = ({ id, downloadMode,bankAccount, bankName }) => {
  return request({
    url: `/sm-sell-order/generalBargain?idList=${id}&downloadMode=${downloadMode}&bankAccount=${bankAccount}&bankName=${bankName}`,
    method: 'post',
    responseType: 'blob'
  })
}

// 预收/预付 未绑定订单数据
export const accGetYsYf = (params) => {
  return request({
    url: '/acc/getYsYf',
    method: 'get',
    params
  })
}

// 绑定预收
export const accBindYsYf = (params) => {
  return request({
    url: '/acc/bindYsYf',
    method: 'get',
    params
  })
}

// 查询预收预付金额
export const accGetYsYfValue = (params) => {
  return request({
    url: '/acc/getYsYfValue',
    method: 'get',
    params
  })
}

// 取消预付/预收
export const accCancelYsYf = (params) => {
  return request({
    url: '/acc/cancelYsYf',
    method: 'get',
    params
  })
}

// 关闭
export const closeOrder = (id) => {
  return request({
    url: `/scm-orders/closeOrder/${id}`,
    method: 'post'
  })
}

export const wmsStockWarehouseList = (id) => {
  return request({
    url: `/wms-stock/warehouse-list?materialId=${id}`,
    method: 'post'
  })
}

export const smSellOrderCloseOrder = (id) => {
  return request({
    url: `/sm-sell-order/closeOrder/${id}`,
    method: 'post'
  })
}

export const smSellOrderExportExcel = (data) => {
  return request({
    url: '/sm-sell-order/exportExcel',
    method: 'post',
    responseType: 'blob',
    data
  })
}

// 毛利计算
export const accGetGrossProfit = (params) => {
  return request({
    url: '/acc/getGrossProfit',
    method: 'get',
    params
  })
}

export const accExportGrossProfit = (data) => {
  return request({
    url: '/acc/exportGrossProfit',
    method: 'post',
    responseType: 'blob',
    data
  })
}

export const codePartnersAddress = (id) => {
  return request({
    url: `/code-partners-address/list/${id}`,
    method: 'post'
  })
}

export const accSellStatementCount = (params) => {
  return request({
    url: `/acc/sellStatementCount?ids=${params}`,
    method: 'get'
  })
}

export const accAccountGetNoUseDetails = (data) => {
  return request({
    url: '/acc_account/getNoUseDetails',
    method: 'post',
    data
  })
}









